<style type="text/css">
    .stateLabel{height:35px;line-height:35px;float:left;display:inline-block;margin:0;cursor:pointer;}
</style>
<div class="comm-top">
	<h4 style="margin-bottom:0">账号信息
        <span style="font-size:12px;color:#aaa;font-weight:normal;">（用户发送关键字/关键词后，并无匹配结果后的返回信息。可以写一些提醒用户的相关操作等）</span>
    </h4>
	<div class="add_page_top"></div>
</div>
<div class="shop_sort_box">
    <form role="form" method="post" id="autoreplyform">
        <input type="hidden" name="id" value="<{$replyRow.id}>">
        <input type="hidden" name="save" value="1">
        <div id="reply_content_div" class="shop_sort">
			<div class="shop_sort_title"><h4>回复内容：</h4></div>
			<div class="shop_sort_set">
                <textarea id="reply_content" class="shop_sort_text" style="width:400px;height:150px;" name="reply_content"><{$replyRow.reply_content}></textarea>
			</div>
        </div>
		<div class="shop_sort">
			<div class="shop_sort_title"><h4>状态：</h4></div>
			<div class="shop_sort_set">
				<label class="stateLabel">
                    <input type="radio" class="stateLabel" style="line-height:35px;margin:0;" value="1" name="state" <{if $replyRow.state!=2}>checked<{/if}> />
                    <span class="stateLabel">开启</span>
                </label>
				<label class="stateLabel" style="margin-left:20px;">
                    <input type="radio" class="stateLabel" style="line-height:35px;margin:0;" value="2" name="state" <{if $replyRow.state==2}>checked<{/if}> />
                    <span class="stateLabel">关闭</span>
                </label>
			</div>
            <div style="clear:both;"></div>
		</div>
		<div class="shop_sort">
			<div class="shop_sort_title">
				<h4>&nbsp;</h4>
			</div>
			<div class="shop_sort_set">
				<span onclick="saveform(this)" id="saveBtn" class="btngreen30">提交保存</span>
			</div>
		</div>
    </form>
</div>
<script type="text/javascript">
	function saveform(obj){
		var reply_content=$("#reply_content").val();
		var reply_keyword=$("#reply_keyword").val();
		if(reply_content=='' && reply_keyword==''){
			note_info('请填写回复内容',obj,'warn');return;
		}
        //敏感词过滤
        if(reply_content != ''){
            var matchStr,senseRow;
            var senseStr='';
            if('<{$senseRow}>'){
                senseRow=$.parseJSON('<{$senseRow}>');
                $.each(senseRow,function(i,n){
                    matchStr=reply_content.match(n);
                    if(matchStr){
                        senseStr+='&nbsp;'+matchStr+'&nbsp;';
                    }
                });
                if(senseStr){
                    note_info('回复内容包含敏感词'+senseStr+'请更换',obj,'warn');return;
                }
            }
        }
        
        $.ajax({
            type: "POST",
            url:"auto_reply.php",
            data:$('#autoreplyform').serialize(),
            success: function(data) {
                if(data=='success'){
                    note_info('保存成功！',obj);
                }
            }
        });
	}
    /*$(document).ready(function(){
    	$('#is_keyword').change(function(){
    		if($(this).val()==1){
    			$('#reply_content_div').hide();
    		    $('#reply_keyword_div').show();
    		}else{
    			$('#reply_keyword_div').hide();
    			$('#reply_content_div').show();
    			
    		}
    	});
    });*/
</script>